<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>菜单</title>
		<script src="../layui/layui.js"></script>
		<link href="../layui/css/layui.css" rel="stylesheet" />
	</head>
	<body>
	 <div class="layui-container">
        <form class="layui-form">
            <div class="layui-form-item">
                <label class="layui-form-label">公告标题</label>
                <div class="layui-input-block">
                    <input type="text" class="layui-input" lay-verify="required|title" name="title" autocomplete="off" placeholder="公告标题，输入中文">
                </div>
            </div>
             <div class="layui-form-item">
                <label class="layui-form-label">截止时间</label>
                <div class="layui-input-inline">
                    <input type="text" class="layui-input" id="validDate" name="validDate" autocomplete="off" placeholder="截止时间，输入中文">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">接收门户</label>
                <div class="layui-input-inline"style="width: 300px;">
                    <input type="radio" lay-filter="mh"  name="mh" title="所有门户" value="0"/>
                    <input type="radio" lay-filter="mh" name="mh" title="指定门户" value="0"/>
                </div>
                <div class="layui-input-inline" id="selectDiv" style="display: none;">
                	<input type="hidden" name="acceptRole" id="acceptRole" value="all" />
                	<select name="acceptRole" id="select_role">
                		<option value="" title="请选择门户"></option>
                		<option value="1">学校门户</option>
                		<option value="2">专家门户</option>
                		<option value="3">网站门户</option>
                	</select>
                </div>
            </div>
           
            <div class="layui-form-item">
            	 <label class="layui-form-label">公告内容</label>
            	 <div>
            	 	<textarea class="layui-textarea" name="content" id="content" layui-filter="content"></textarea>
            	 </div>
            	</div>
            	 <div class="layui-form-item">
            	<div class="layui-input-block">
            		<a class="layui-btn" lay-submit="" layui-filter="submitBtn" id="submitBtn">提交</a>
            		<a class="layui-btn" lay-submit="" layui-filter="Btn" id="Btn">草稿</a>
            	</div>
            </div>
          </form>  
	 </div>
	<script>
		var $;
		layui.use(['form','laydate','layedit','jquery','layer'],function(){
			var form=layui.form,laydate=layui.laydate,layer=layui.layer,
			layedit=layui.layedit;
			$=layui.jquery;
			
			form.on('radio(mh)',function(data){
			 var value=data.value;
			 if(value==0){
			 	$('#selectDiv').hide();
			 	$('#acceptRole').val('all');
			 }else{
			 	$('#selectDiv').show();
			 	$('#acceptRole').val("");
			 	
			 }
			})
			
		   form.verify({
		   	title:[/^[\u4e00-\u9fa5]{1,}$/,'请输入中文标题']
		   });
		   
		   
			
			var date=new Date();
			var newDate=date.getFullYear()+"-"+(date.getMonth()+1)+"-"+date.getDate();
			//时间初始化
			laydate.render({
				elem:'#validDate',
				min:newDate
			})
			//初始化富文本
			var index= layedit.build('content',{
				tool:['underline','strong','left','right','center','face'],
				height:350,
//				uploadImage:{url:'',type:'post'}
			})
			
			var active={
				insertOrUpdate:function(status){
						//获取编辑器的内容
				var content=layedit.getContent(index);
				
				var formData=data.field;
				//把内容放入属性
				formData.conter=content;
				formData.status=status;
				
				$.ajax({
					type:"post",
					url:"${ssm}/system/nc/inserOrUpdate",
					dataType:'json',
					async:true,
					success:function(result){
						top.layer.msg(result.msg);
						layer.closeAll();
					}
					
				});
				}
			}
			
			form.on('submit(submit)',function(data){
			insertOrUpdate:function(status)
				
			})
			
		});
		function btnSubmit(){
			$('#')
		}
	</script>
	</body>
</html>
